]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/label: Invalidate text shadow on style changes to ClutterText
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 5 Mar 2021 11:46:00 +0000 (12:46 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 14 Feb 2022 12:52:20 +0000 (12:52 +0000)
Just like with the last commit, listen to some ClutterText property
changes to catch style changes that were trigerred by
_st_set_text_from_style() and invalidate the shadow spec on changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>

src/st/st-label.c

index b4dd8cd56ca9120d11f578c0710f72cb04c400ef..1cf0859dfbe5b2dd0fc44b93db226eb70dab171e 100644 (file)
@@ -301,6 +301,16 @@ st_label_class_init (StLabelClass *klass)
   g_object_class_install_properties (gobject_class, N_PROPS, props);
 }
 
+static void
+invalidate_shadow_pipeline (GObject    *object,
+                            GParamSpec *pspec,
+                            StLabel    *label)
+{
+  StLabelPrivate *priv = st_label_get_instance_private (label);
+
+  g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
+}
+
 static void
 st_label_init (StLabel *label)
 {
@@ -316,6 +326,19 @@ st_label_init (StLabel *label)
   label->priv->shadow_width = -1.;
   label->priv->shadow_height = -1.;
 
+  /* These properties might get set from CSS using _st_set_text_from_style */
+  g_signal_connect (priv->label, "notify::font-description",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
+  g_signal_connect (priv->label, "notify::attributes",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
+  g_signal_connect (priv->label, "notify::justify",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
+  g_signal_connect (priv->label, "notify::line-alignment",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
   clutter_actor_add_child (actor, priv->label);
 
   clutter_actor_set_offscreen_redirect (actor,